using System;
using System.Collections.Generic;

namespace SY.WebSite.Entity
{
	/// <summary>
	///	
	/// </summary>
	[Serializable]
	public class Auction : IEntity
	{
		public const string RESERVE_CONST = "Auction";
			
		#region Private Members
		private int _id; 
		private string _title; 
		private string _Description; 
		private string _image; 
		private int _type; 
		private int _count; 
		private int _createBy; 
		private DateTime _createTime; 
		private DateTime _startTime; 
		private DateTime _endTime; 
		private int _status; 		
		[NonSerialized]
        private string _reserve;
		#endregion
		
		#region Default ( Empty ) Class Constuctor
		/// <summary>
		/// default constructor
		/// </summary>
		public Auction()
		{
			_id = 0; 
			_title = null; 
			_Description = null; 
			_image = null; 
			_type = 0; 
			_count = 0; 
			_createBy = 0; 
			_createTime = new DateTime(); 
			_startTime = new DateTime(); 
			_endTime = new DateTime(); 
			_status = 0; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor
		
		public Dictionary<string, object> ToDictionary()
		{
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
		
			dictionary.Add("Id",_id);
			dictionary.Add("Title",_title);
			dictionary.Add("Description",_Description);
			dictionary.Add("Image",_image);
			dictionary.Add("Type",_type);
			dictionary.Add("Count",_count);
			dictionary.Add("CreateBy",_createBy);
			dictionary.Add("CreateTime",_createTime);
			dictionary.Add("StartTime",_startTime);
			dictionary.Add("EndTime",_endTime);
			dictionary.Add("Status",_status);
			
			dictionary.Add("Reserve",Reserve);//特殊
			return dictionary;
		}
		
		#region Public Properties
		/// <summary>
		/// 
		/// </summary>		
		public int Id
		{
			get { return _id; }
			set { _id = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Title
		{
			get { return _title; }
			set	
			{
				if( value!= null && value.Length > 200)
					throw new ArgumentOutOfRangeException(@"Invalid value for Title", value, value);
				
				_title = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Description
		{
			get { return _Description; }
			set	
			{
				if( value!= null && value.Length > 500)
					throw new ArgumentOutOfRangeException(@"Invalid value for Description", value, value);
				
				_Description = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Image
		{
			get { return _image; }
			set	
			{
				if( value!= null && value.Length > 500)
					throw new ArgumentOutOfRangeException(@"Invalid value for Image", value, value);
				
				_image = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Type
		{
			get { return _type; }
			set { _type = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Count
		{
			get { return _count; }
			set { _count = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int CreateBy
		{
			get { return _createBy; }
			set { _createBy = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime CreateTime
		{
			get { return _createTime; }
			set { _createTime = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime StartTime
		{
			get { return _startTime; }
			set { _startTime = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime EndTime
		{
			get { return _endTime; }
			set { _endTime = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Status
		{
			get { return _status; }
			set { _status = value; }
		}
			
		/// <summary>
        /// 保留属性
        /// </summary>
        public string Reserve
        {
            get 
            {
                if (string.IsNullOrEmpty(_reserve))
                    return RESERVE_CONST  ;

                return _reserve; 
            }
            set { _reserve = value; }
        }
		#endregion 
	}
}
